
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
=====
Fork from supershabam/ready
NodeJS mixin to add one-time ready event
Using ready
or ready.mixin
to add ready
method to the given object.
const ready = require('get-ready');
const obj = {};
ready.mixin(obj);
// register a callback
obj.ready(() => console.log('ready'));
// mark ready
obj.ready(true);
Register a callback to the callback stack, it will be called when mark as ready, see example above.
If the callback is undefined, register will return a promise.
obj.ready().then(() => console.log('ready'));
obj.ready(true);
If it has been ready, the callback will be called immediately.
// already ready
obj.ready(true);
obj.ready().then(() => console.log('ready'));
Warning: the callback is called after nextTick
Mark it as ready, you can simply using .ready(true)
.
You can also mark it not ready.
obj.ready(true);
// call immediately
obj.ready(() => console.log('ready'));
obj.ready(false);
obj.ready(() => throw 'don\'t run');
When exception throws, you can pass an error object, then the callback will receive it as the first argument.
obj.ready(err => console.log(err));
obj.ready(new Error('err'));
3.0.0 (2023-06-05)
https://github.com/eggjs/egg-core/issues/264
FAQs
mixin to add one-time ready event callback handler
The npm package get-ready receives a total of 155,463 weekly downloads. As such, get-ready popularity was classified as popular.
We found that get-ready demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 14 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.